<?php

// [ 阿里大鱼短信码 ]
// use app\common\lib\Sms;
// $type   = 'SMS_CODE';
// $mobile = '';
// $code   = '';
// $bool   = Sms::send($type,$mobile,$code);

namespace app\common\lib;
use anerg\Alidayu\SmsGateWay;

class Sms
{
    public static function send($type, $mobile, $code)
    {
        switch ($type) {
            // 短信码
            case 'SMS_CODE':
                $appkey    = '23871704';
                $appsecret = '0e5acce8985826fdac21cfe9e87c1d69';
                $signature = '价值链';
                $tpl       = 'SMS_68815021';
                $AliSMS = new SmsGateWay($appkey, $signature);
                return $AliSMS->send($mobile, ['code'=>$code,'product'=>'价值链'], $tpl, $appsecret);
                break;
            
            // 优惠码
            case 'SMS_COUPON':
                $appkey    = '23871704';
                $appsecret = '0e5acce8985826fdac21cfe9e87c1d69';
                $signature = '价值链';
                $tpl       = 'SMS_78760072';
                $AliSMS = new SmsGateWay($appkey, $signature);
                return $AliSMS->send($mobile, ['code'=>$code,'discount'=>'8','product'=>'价值链'], $tpl, $appsecret);
                break;

            default:
                # code...
                break;
        }

        // $AliSMS = new SmsGateWay($appkey, $signature);
        // return $AliSMS->send($mobile, ['code'=>$code,'product'=>'价值链'], $tpl, $appsecret);
    }
}
